home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
676-700
/
682
/
reqchange
/
extra
/
reqask.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
2KB
|
103 lines
/* ReqAsk. Requester based Ask replacement. Public Domain by Magnus Holmgren
in 1992.
Compile with DICE:
dcc -pr -2.0 -ms -proto -mRR -o ReqAsk ReqAsk.c
Other compilers requires changes!
*/
#include <stdlib.h>
#include <exec/types.h>
#include <exec/execbase.h>
#include <dos/rdargs.h>
#include <dos/dos.h>
#include <intuition/intuition.h>
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
extern struct DOSBase *DOSBase;
extern struct IntuitionBase *IntuitionBase;
extern struct ExecBase *SysBase;
struct EasyStruct es =
{
sizeof( struct EasyStruct ),
0,
NULL,
NULL,
NULL,
};
#define BODYFMT 0
#define GADGETFMT 1
#define TITLE 2
#define VARIABLE 3
#define GLOBAL 4
const TEXT VersTag[] = "$VER: ReqAsk V1.0 (20.01.92)";
const TEXT OS2Required_Msg[] = "You need OS 2.04+\n";
ULONG flags[] = { 0, 0, 0, 0, 0 };
_main()
{
struct RDArgs *rdargs;
STRPTR title, body, gadget;
ULONG ret;
TEXT buf[ 1 ];
if( SysBase -> LibNode . lib_Version < 37 )
{
Write( ( BPTR ) Output(),
OS2Required_Msg,
sizeof( OS2Required_Msg ) - 1 );
_exit( RETURN_FAIL );
}
rdargs = ReadArgs( "BODYFMT/A,GADFMT,TITLE,VAR,GLOBAL/S", flags, NULL );
if( rdargs == NULL )
{
PrintFault( IoErr(), "Error in argument line", );
_exit( RETURN_ERROR );
}
if( *( ( STRPTR ) flags[ BODYFMT ] ) == '\0' )
{
PutStr( "No valid BODYFMT string" );
_exit( RETURN_ERROR );
}
if( !flags[ GADGETFMT ] || *( ( STRPTR ) flags[ GADGETFMT ] ) == '\0' )
{
flags[ GADGETFMT ] = "Yes|No";
}
if( !flags[ VARIABLE ] || *( ( STRPTR ) flags[ VARIABLE ] ) == '\0' )
{
flags[ VARIABLE ] = "ReqAskResult";
}
es.es_Title = ( STRPTR ) flags[ TITLE ];
es.es_TextFormat = ( STRPTR ) flags[ BODYFMT ];
es.es_GadgetFormat = ( STRPTR ) flags[ GADGETFMT ];
ret = EasyRequestArgs( NULL, &es, NULL, NULL );
buf[ 0 ] = ( UBYTE ) ( ret + '0' );
ret = RETURN_OK;
if( !SetVar( ( STRPTR ) flags[ VARIABLE ],
buf,
1,
flags[ GLOBAL ] ? GVF_GLOBAL_ONLY : GVF_LOCAL_ONLY ) )
{
PutStr( "Error setting result variable\n" );
ret = RETURN_FAIL;
}
FreeArgs( rdargs );
_exit( ret );
}